//package com.gddb.xwj.mywiki.filter;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
//
///**
// * 描述：过滤器时间打印接口耗时
// *
// * @author xwj
// * @create 2022-03-21 1:07
// */
//@Component
//@Slf4j
//public class LogFilter implements Filter {
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        //打印请求信息
//        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        log.info("------------- LogFilter 开始 -------------");
//        log.info("请求地址: {} {}", request.getRequestURL().toString(), request.getMethod());
//        log.info("远程地址: {}", request.getRemoteAddr());
//
//        long startTime = System.currentTimeMillis();
//        filterChain.doFilter(servletRequest, servletResponse);
//        log.info("------------- LogFilter 结束 耗时：{} ms -------------", System.currentTimeMillis() - startTime);
//    }
//}
